/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.farmcode.api.runtime;

import java.io.Serializable;
import java.util.Stack;

/**
 *
 * @author oiprado
 */
public class BaseResponse <T> implements Serializable, Response<T> {
  protected String errorMessage;
  protected T result;
  private Stack<String> stackTrace = new Stack<String>();

  @Override
  public String errorMessage() {
    return errorMessage;
  }
  
    @Override
  public void addMessage(String message){
        getStackTrace().add(message);
  }
  
    @Override
  public void addMessage(Throwable message){
    addMessage(message.getMessage());
  }

  @Override
  public T getResult() {
    return result;
  }

  @Override
  public void setResult(T result) {
    this.result = result;
  }

    /**
     * @return the stackTrace
     */
    @Override
    public Stack<String> getStackTrace() {
        return stackTrace;
    }

    /**
     * @param stackTrace the stackTrace to set
     */
    @Override
    public void setStackTrace(Stack<String> stackTrace) {
        this.stackTrace = stackTrace;
    }
}
